package com.itheima.dao;

import com.itheima.pojo.BlogSort;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

@Repository
@org.apache.ibatis.annotations.Mapper
public interface SortMapper extends Mapper<BlogSort> {
    //查询最大排序字段
    @Select("SELECT MAX(t_blog_sort.sort) FROM t_blog_sort")
    Integer findMaxSort();

    //查询引用量
    @Select("SELECT COUNT(t_blog.blog_sort_uid) FROM t_blog WHERE t_blog.blog_sort_uid =#{uid} GROUP BY t_blog.blog_sort_uid")
    Integer citeNum(@Param("uid") String uid);
}
